﻿<UserControl x:Name="root" x:Class="StylusTipTuner"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:u="clr-namespace:InkType.Util;assembly=InkType.Util"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300"
             DataContext="{Binding DrawingAttributes, RelativeSource={RelativeSource Self}}">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition/>
        </Grid.RowDefinitions>
        <ListBox ItemsSource="{u:EnumValues {x:Type StylusTip}}" SelectedItem="{Binding StylusTip, Mode=TwoWay}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <WrapPanel/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
        </ListBox>
        <Control x:Name="g" Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center"
                 Width="{Binding Width, Mode=TwoWay}" Height="{Binding Height, Mode=TwoWay}">
            <Control.Template>
                <ControlTemplate TargetType="{x:Type Control}">
                    <Grid>
                        <Ellipse x:Name="pe" Fill="Black" Visibility="Collapsed"/>
                        <Rectangle x:Name="pr" Fill="Black" Visibility="Collapsed"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <DataTrigger Binding="{Binding StylusTip}" Value="{x:Static StylusTip.Ellipse}">
                            <Setter TargetName="pe" Property="Visibility" Value="Visible"/>
                        </DataTrigger>
                        <DataTrigger Binding="{Binding StylusTip}" Value="{x:Static StylusTip.Rectangle}">
                            <Setter TargetName="pr" Property="Visibility" Value="Visible"/>
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Control.Template>
        </Control>
    </Grid>
</UserControl>
